import * as articlesApi from '@/api/articles';
export default {
  namespaced: true,
  state: {
    articleList: [],
    articleContent: []
  },
  mutations: {
    SET_ARTICLE_LIST(state, newValue) {
      state.articleList = newValue;
    },
    GET_ARTICLE_CONTENT(state, newValue) {
      state.articleContent = newValue;
    },
  },
  actions: {
    async updateArticleList({ commit }, id) {
      const res = await articlesApi.getArticlesList(id);
      commit('SET_ARTICLE_LIST', res)
    },
    async updateArticleContent({ commit }, id) {
      const res = await articlesApi.getArticleContent(id);
      commit('GET_ARTICLE_CONTENT', res)
    }
  }
}
// export default {
//   namespaced: true,
//   state: {
//     articleContent: []
//   },
//   mutations: {
//     GET_ARTICLE_CONTENT(state, newValue) {
//       state.articleContent = newValue;
//     },
//   },
//   actions: {
//     async updateArticleContent({ commit }, id) {
//       const res = await articlesApi.getArticleContent(id);
//       commit('GET_ARTICLE_CONTENT', res)
//     }
//   }
